﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AnesSystem.Models;
using AnesSystem.Services;

namespace AnesSystem
{
    public class OperationDataPool : BaseManager<OperationDataPool>
    {
        #region Variables
        private OperationData _curOperationData;
        private Dictionary<string, OperationData> _dicOID2AllData = new Dictionary<string, OperationData>();
        private static bool _changePatient = false;

        #endregion


        #region Constructor
        public OperationDataPool()
        {

        }


        #endregion


        #region Properties

        public OperationData CurOperationData
        {
            get
            {
                return _curOperationData;
            }

            set
            {
                _curOperationData = value;
            }
        }

        public static bool ChangePatient
        {
            get
            {
                return _changePatient;
            }

            set
            {
                _changePatient = value;
            }
        }


        #endregion


        #region 依赖属性


        #endregion


        #region Event


        #endregion


        #region PrivateMethods
        private OperationData CreateAlldata(PatientLinkModel patientLink)
        {
            OperationData op = new OperationData(patientLink);
            return op;

        }



        #endregion


        #region Public/ProtectedMethods

        /// <summary>
        /// 设置缓存病人信息
        /// </summary>
        public void SetCurOer()
        {
            if (!_dicOID2AllData.ContainsKey(DataManager.Instance.CurrentPatientLink.Id.ToString()))
            {
                _dicOID2AllData.Add(DataManager.Instance.CurrentPatientLink.Id.ToString(), CreateAlldata(DataManager.Instance.CurrentPatientLink));
            }
            _curOperationData = _dicOID2AllData[DataManager.Instance.CurrentPatientLink.Id.ToString()];

        }

        #endregion


        #region EventHandlers


        #endregion
    }
}
